Attribute VB_Name = "modMain"
'***************************************************************
' (c) Copyright 2000 Matthew J. Curland
'
' This file is from the CD-ROM accompanying the book:
' Advanced Visual Basic 6: Power Techniques for Everyday Programs
'   Author: Matthew Curland
'   Published by: Addison-Wesley, July 2000
'   ISBN: 0-201-70712-8
'   http://www.PowerVB.com
'***************************************************************
Option Explicit
Public Const strCLSID_APPCONTEXT As String = "{325FBD60-35EC-11D4-91FE-D41203C10000}"

Sub Main()
    InitVBoost
    MDIFormMain.Show
End Sub

Public Function ShowNewForm(FullOcxPath As String, ControlOrCLSID As String, Optional RTLicenseKey As String) As Object
Dim NewForm As New frmDynamic
    'Allow an existing form to show a new form
    With g_OcxTargetData
        If AscW(ControlOrCLSID) = 123 Then '123 = {, assume this is a guid
            .CLSID = GUIDFromString(ControlOrCLSID)
        Else
            .CLSID = CLSIDFromFileAndClassName(FullOcxPath, ControlOrCLSID)
        End If
        .RTLicenseKey = RTLicenseKey
        .TargetOcx = FullOcxPath
        .fTargetAbsolute = True
    End With
    NewForm.Show
    Set ShowNewForm = NewForm.ctlDynamic.object
End Function


